<template>
	<view>
		<map class="map" :latitude="latitude" :longitude="longitude"></map>
	</view>
</template>

<script>
	// 引入SDK核心类，地图组件
	import QQMapWX from '../../static/lib/qqmap-wx-jssdk.js'
	export default {
		data() {
			return {
				latitude: '29.88595', // 纬度
				longitude: '116.536857', // 经度
				qqmapsdk: '',
			}
		},
		methods: {
		},
		onLoad: function() {
			console.log("aaaaaaaaaaaaaaaaaaa")
			// 实例化API核心类
			this.qqmapsdk = new QQMapWX({
				key: 'ZMIBZ-35VR4-RNWUG-F5ZNG-G5JO5-IEFXK'
			});
			let plugin = requirePlugin('routePlan');
			let key = 'ZMIBZ-35VR4-RNWUG-F5ZNG-G5JO5-IEFXK'; //使用在腾讯位置服务申请的key
			let referer = 'wx65ba4a27e9054feb'; //调用插件的app的名称
			let endPoint = JSON.stringify({ //终点
				'name': '北京西站',
				'latitude': 39.894806,
				'longitude': 116.321592,
			});
			uni.navigateTo({
				url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
			});
		},
		onShow: function() {
			console.log()
			// 调用接口
			this.qqmapsdk.search({
				keyword: '酒店',
				success: function(res) {
					console.log(res);
				},
				fail: function(res) {
					console.log(res);
				},
				complete: function(res) {
					console.log(res);
				}
			});
		}
	}
</script>

<style scoped>
	.map {
		width: 100vw;
		height: 100vh;
	}
</style>